1. Field of the Invention
The present invention relates to a device and a method for data encoding and a method for data transmission, and more particularly, is suitably applied to a device and a method for data encoding and a method for data transmission for compressively coding picture data, for example.
2. Description of Related Art
Various compressive coding methods have been provided as methods for recording and transmitting picture data in a reduced amount of information when picture data is recorded in the record media such as a magneto-optical disk and a magnetic tape as digital data or when picture data is transmitted via a specified transmission media. As typical of them, there is a Moving Picture Experts Group Phase 2 (MPGE2) method. Nowadays a digital broadcasting system for compressively coding picture data using that MPEG2 method and broadcasted it via ground waves or satellite waves is begun.
In this compressive coding method by the MPEG2 method, picture data is encoded with defining picture data composed of fifteen frames as one processing unit called group of pictures (GOP). For instance, as shown in FIGS. 1A and 1B, in one GOP (frames F0-F14), there are an intra-picture: intraframe-coded picture (I-picture), a predictive-picture: interframe forward predictively-coded picture (P-picture) and a bidirectionally predictive-picture: bidirectionally predictively-coded picture (B picture).
The I-picture is used to keep the independence of GOP, and the entire picture is coded (intra-coding). The P-picture is predictively coded in the forward direction using an I-picture and a P-picture existing in the temporal past (forward predictive coding). And the B-picture is predictively coded from both directions using an I-picture or a P-picture existing in the temporal past and future (bidirectional predictive coding).
By the way, as shown in FIG. 2, if a scene changes in a series of pictures to be transmitted, pictures are largely different between a scene A and a scene B. So that, even if a frame picture after the scene change is predicted according to a reference picture before the scene change, an extremely large error is included in difference data between the predicted frame picture and the reference picture, and thus, image quality deteriorates. Moreover, if another frame picture is compressively coded using that frame picture deteriorated in quality as a reference picture, image quality further deteriorates.
To prevent such things, as shown in FIG. 3, the GOP 2 of the scene A is ended at the time point of a scene change, and from a scene B after the scene change, an I-picture is inserted and a new GOP 3 is begun. Thereby, predictive coding can be performed without using the frame pictures of the GOP 2 as reference pictures but the I-picture in the GOP 3 after the scene change as a reference picture. Thus, the propagation of the deterioration of image quality can be prevented.
Here, the configuration of a data encoding device for performing scene change detection is shown in FIG. 4. In FIG. 4, the data encoding device 100 supplies picture data D100 to a scene change detection circuit 101 and a delay circuit 103 individually.
The scene change detection circuit 101 calculates the absolute difference sum of brightness, e.g., between two successive frames. For instance, if absolute difference sum of brightness between the P-picture of a frame F5 and the B-picture of the frame F6 in the GOP 2 exceeds a prescribed threshold value, the scene change detection circuit 101 judges that a scene is changed from the scene A to the scene B, and transmits scene change information data D101 to a picture type decision circuit 102 at this time.
To prevent the propagation of the deterioration of image quality to be caused by predictively coding a frame picture after the scene change using the frame picture before the scene change as a reference frame, the picture type decision circuit 102 specifies its picture type (for instance, the I-picture in the GOP 3 in FIG. 5 is to be a reference frame) when a frame picture after the scene change is encoded, and transmits specifying data D102 to a data encoding device 50.
On the other hand, the picture data D100 inputted to the delay circuit 103 is delayed for a time when the scene change detection circuit 101 and the picture type decision circuit 102 are performing the processing. The picture data D100 is supplied to the data encoding device 50 synchronizing with the timing that the specifying data D102 is supplied.
Here, the data encoding device 50 inputs the picture data D100 to a pre-filter 51 as shown in FIG. 6. The pre-filter 51 applies band limitation on the picture data D100 according to a frequency characteristic control signal S55 supplied from a quantization rate control part 55, and reducing the high frequency component of the above picture data D100, and transmits it to pixel conversion part 52 as band-limited picture data D51.
The pixel conversion part 52 applies pixel conversion processing on band-limited picture data D51. That is, assuming a number of pixels in the horizontal direction of the picture data D100 as horizontal pixel M and a number of pixels in the vertical direction of that as vertical pixel N, the pixel conversion part 52 reduces the horizontal pixel M and the vertical pixel N of the band-limited picture data D51 that has been obtained by band-limiting the above picture data D100 into horizontal pixel m and vertical pixel n that satisfy the relation of m less than M and n less than N, and transmits them to an encoding part 53 as pixel-converted picture data D52.
Here, the horizontal pixel m and the vertical pixel n are set according to the image contents of the picture data D100, in large values in image contents requiring being high image quality, and in small values in image .contents not requiring.
The encoding part 53 performs compressive coding to the pixel-converted picture data D52 by applying motion compensation processing, discrete cosine transform (DCT) processing, quantization processing and variable length coding (VLC) processing, and then transmits it to a transmission buffer 54 as variable-length coded data D53. At this time, the encoding part 53 modulates a quantization step size in quantization processing based on a quantization control signal S56 supplied from the quantization rate control part 55.
Moreover, an encoding part control part 57 supplies picture types based on the specifying data D102 supplied from the picture type decision circuit 102, coding timings and a search range of motion vectors in motion compensation processing, to the encoding part 53 as encoding part control information D57. Thereby, the above encoding part 53 sets picture types, encoding timings and a motion vector search range in motion compensation processing according to the above encoding part control information D57.
A code amount to be generated in each frame of the variable-length coded data D53 varies according to the image content of the picture data D100. Therefore, the encoding part 53 controls a quantization step size in the quantization processing and band limitation in the pre-filter 51 and accumulates the variable-length coded data D53 for several frames in the transmission buffer 54, and then outputs as fixed-length coded data D50 in which a code amount generated per GOP has been controlled in fixed amount for a fixed period.
That is, the quantization rate control part 55 always monitors the accumulation of the variable-length coded data D53 in the transmission buffer 54 and .obtaining this accumulation as occupancy rate information S54, and generate a quantization control signal S56 and a frequency characteristic control signal S55 based on the above occupancy rate information S54, and supplies this to the encoding part 53 and the pre-filter 51. In this manner, the encoding part 53 generates the fixed-length coded data D50 in which a code amount to be generated for a fixed period is fixed.
In the above data encoding device 100, as shown in FIG. 7, the GOP 2 is ended at the timing of a scene change, and an I-picture is newly inserted and the GOP 3 is begun. Furthermore, if the moving amount of a picture is large and a difference value with the previous frame picture is larger than a prescribed threshold value in the pixel conversion part 52 of the data encoding device 50, the data encoding device 100 reduces a number of pixels at that timing (pixel switching point).
In the data encoding device 100 as described above, a timing of scene change and a timing for reducing a number of pixels are shifted. Therefore, there is a problem that if the number of pixels of a frame picture with a large moving amount is reduced and the frame size is reduced in a sequence (scene A), a viewer sensitively notices the change of image quality unfortunately since it is in the same scene and has unnatural feeling.
In view of foregoing, an object of this invention is to provide a device and a method for encoding that can always generate high quality coded data irrespective of a change of picture and a method for transmitting such data.
The foregoing object and other objects of the invention have been achieved by the provision of a device for method and device for data encoding and method for data transmission. In the case where a difference between two adjacent frames in inputted picture data is calculated as well as motion vectors between the above frames and the picture data is encoded according to the above interframe difference and motion vectors as well as the motion vectors, a scene change in the above picture data is detected based on the difference between two adjacent frames in the picture data, a feature amount of the picture data is calculated, and if the above feature amount exceeds a prescribed threshold value, the number of pixels of the picture data is reduced in a prescribed conversion ratio at the prescribed timing based on the detected scene change, and the picture data and the motion vectors are encoded so that their code amount equals the code amount to be generated obtained by allotting the code amount of motion vectors, representing the movement of the picture data, reduced in proportion to said picture data in which the number of pixels has been reduced.
By reducing the number of pixels at the prescribed timing based on the detected scene change, the timing to reduce the number of pixels with the timing of the scene change. Therefore, high-quality coded data in which the deterioration of image quality is prevented can be generated.
In the case where a difference between two adjacent frames in inputted picture data is calculated as well as motion vectors between the above frames the picture data is encoded based on the above interframe difference and motion vectors as well as the motion vectors, a scene change in the above picture data is detected based on the difference between the two adjacent frames in the picture data, first coded data is generated by encoding the picture data and the motion vectors without converting the number of pixels of the picture data, and also second coded data is generated by encoding the picture data and the motion vectors so that their code amount equals the code amount to be generated obtained by allotting the code amount of motion vectors, representing the movement of the picture data, reduced in proportion to the pixel-converted data. The image quality of the first coded data and the image quality of the second coded data are compared. And if the second coded data is selected based on the above comparison result, the above second coded data is outputted at a prescribed timing based on the scene change.
If the above second Coded data is selected since the image quality of the second coded data is better than that of the first coded data, it is outputted at the prescribed timing based on the scene change. Thereby, a timing for outputting the second coded data and a timing of scene change can be associated. Thus, high quality coded data in which the deterioration of image quality is prevented can be generated.
The nature, principle and utility of the invention will become more apparent from the following detailed description when read in conjunction with the accompanying drawings in which like parts are designated by like reference numerals or characters.